//
//  HeadView.m
//  NewChat
//
//  Created by lanou3g on 16/3/1.
//  Copyright © 2016年 蓝鸥. All rights reserved.
//

#import "HeadView.h"

#define kHeight self.frame.size.height
#define kWidth self.frame.size.width

@implementation HeadView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {

        [self addAllviews];
        
    }
    return self;
}

-(void)addAllviews{
    
    [self addSubview:self.headImV];
    [self addSubview:self.userNameLbl];
    [self addSubview:self.genderLbl];
    [self addSubview:self.constellationLbl];
    [self addSubview:self.voiceBtn];
    
}

#pragma mark=======懒加载============

-(UIImageView *)headImV{
    
    if (!_headImV) {
        
        _headImV = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth*0.1,kHeight*0.225,kWidth*0.2,kWidth*0.2)];
        _headImV.backgroundColor = [UIColor clearColor];
        //设置圆角
        _headImV.layer.cornerRadius = kWidth*0.1;
        _headImV.layer.masksToBounds = YES;
        
    }
    return _headImV;
}

-(UILabel *)userNameLbl{
    
    if (!_userNameLbl) {
        
        _userNameLbl = [[UILabel alloc]initWithFrame:CGRectMake(kWidth*0.33,kHeight*0.26,kWidth*0.6,kHeight*0.15)];
        _userNameLbl.backgroundColor = [UIColor clearColor];
    }
    
    return _userNameLbl;
}

-(UILabel *)genderLbl{
    
    if (!_genderLbl) {
        _genderLbl = [[UILabel alloc]initWithFrame:CGRectMake(kWidth*0.33,kHeight*0.43,kWidth*0.15,kHeight*0.11)];
        _genderLbl.backgroundColor = [UIColor clearColor];
        _genderLbl.textAlignment = NSTextAlignmentCenter;
    }
    return _genderLbl;
    
}

-(UILabel *)constellationLbl{
    
    if (!_constellationLbl) {
        
        _constellationLbl = [[UILabel alloc]initWithFrame:CGRectMake(kWidth*0.5,kHeight*0.43,kWidth*0.15,kHeight*0.11)];
        _constellationLbl.backgroundColor = [UIColor clearColor];
        _constellationLbl.textAlignment = NSTextAlignmentCenter;
    }
    
    return _constellationLbl;
}

-(UIButton *)voiceBtn{
    if (!_voiceBtn) {
        _voiceBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _voiceBtn.frame = CGRectMake(kWidth*0.2, kHeight*0.75, kWidth*0.6, kHeight*0.2);
        _voiceBtn.backgroundColor = [UIColor clearColor];
        _voiceBtn.layer.borderWidth = 1;
    }
    return _voiceBtn;

}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
